/*
** basics.c for alum1 in /home/nadali_t//local/Projets/CprgElem/alum1
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Mon Feb  6 13:59:16 2012 thomas nadalie
** Last update Mon Feb  6 15:27:35 2012 thomas nadalie
*/

#include	"my.h"

void	my_putchar(char c)
{
  write(1, &c, 1);
}

int	my_strlen(char *str)
{
  int	i;

  i = 0;
  while (str[i])
    i++;
  return (i);
}

void	my_putstr(char *str)
{
  int	i;

  i = 0;
  while (str[i])
    my_putchar(str[i++]);
}

int             my_getnbr(char *str)
{
  int           result;
  int           puiss;

  result = 0;
  puiss = 1;
  while (('-' == (*str)) || ((*str) == '+'))
    {
      if (*str == '-')
        puiss = puiss * -1;
      str++;
    }
  while ((*str >= '0') && (*str <= '9'))
    {
      result = (result * 10) + ((*str) - '0');
      str++;
    }
  return (result * puiss);
}
